package com.zgkxzx.mvvmbase.view.adapter;

import android.content.Context;

import com.zgkxzx.mvvmbase.R;
import com.zgkxzx.mvvmbase.bean.picture.PictureBean;
import com.zgkxzx.mvvmbase.databinding.ListItemPicturesBinding;
import com.zgkxzx.mvvmbase.viewmodel.ItemViewModel;

import java.util.List;

/**
 * 创建者 zgkxzx
 * 日期   2/2/18
 * 描述
 */

public class PicturesAdapter2 extends BaseAdapter<ListItemPicturesBinding, PictureBean> {


    public PicturesAdapter2(Context context, List<PictureBean> list) {
        super(context, list);
    }

    @Override
    protected int getItemLayoutId() {
        return R.layout.list_item_pictures;
    }


    @Override
    protected void bindItemView(Context context, ListItemPicturesBinding binding, int position) {
        PictureBean pictureBean = list.get(position);

        if (binding.getItemViewModel() == null)
            binding.setItemViewModel(new ItemViewModel(context, pictureBean));
        else
            binding.getItemViewModel().setPictureBeanData(pictureBean);
    }

}
